//
//  SmokeRemoteTestApi.m
//  AFNetworking
//
//  Created by tracyhenry on 2022/7/28.
//

#import "SmokeRemoteTestApi.h"
#import "SiterHelp.h"
@interface SmokeRemoteTestApi()
@property(nonatomic,strong)NSNumber *eqid;
@end
@implementation SmokeRemoteTestApi

-(id)initWithDevId:(NSString *)devId withMac:(NSString *)mac withSubAddress:(NSNumber *)eqid{
    if(self = [super init]){
        self.devId = devId;
        self.mac = mac;
        self.eqid = eqid;
    }
    return self;
}

-(id)requestCmdId{
    return @ControllDevice;
}


-(id)requestArgumentCommand{
    [super msgChange];
    
    NSString *ss = [SiterHelp gethexBybinary:[self.eqid intValue] withContentLength:4];

    NSString *de = [ss stringByAppendingString:@"050007"];
    
    
    NSString *ss2 = [SiterHelp gethexBybinary:self.msgId];
    NSInteger length2 = ss2.length;
    for(int i = 0;i<2-length2;i++){
        ss2 = [@"0" stringByAppendingString:ss2];
    }
    
    NSString *de2 = [[@"01" stringByAppendingString:ss2] stringByAppendingString:@"02100000"];
    
    return @{
             @"namespace":@"config",
             @"source":@"app",
             @"target":@"gateway",
             @"hw_id":self.mac,
             @"msg_id":@(self.msgId),
             @"msg":@{
                 @"CMD_CODE":[self requestCmdId],
                 @"str1":de,
                 @"str2":de2,
                 @"str3":@"",
               }
            };
}

-(BOOL)isSetApi{
    return YES;
}

-(BOOL)isMqttOnly{
    return NO;
}

@end
